package com.mchsdk.paysdk.http;

import java.io.UnsupportedEncodingException;
import java.util.Map;

import org.apache.http.entity.StringEntity;

import com.lidroid.xutils.http.RequestParams;
import com.lidroid.xutils.http.callback.RequestCallBack;
import com.mchsdk.paysdk.utils.MCLog;

public class Post {
	private static final String TAG="Post";
	private static int postcode;

	public int getCode() {
		return postcode;
	}

	public void post(int code, String url, Map<String, String> map,
			RequestCallBack<String> callBack) {
		postcode = code;
		String strParams = RequestParamUtil.getRequestParamString(map);
		RequestParams params = new RequestParams();
		try {
			params.setBodyEntity(new StringEntity(strParams));
		} catch (UnsupportedEncodingException e) {
		}
		MCLog.i(TAG, "postCode = " + postcode);
		MCLog.i(TAG, "postUrl = " + url);
		HTTPPost.post(url, params, callBack);
	}
}
